import React, { useEffect, createContext } from 'react';
import Footer from '@/components/footer';
import Player from '@/components/find/components/player'
import styles from './index.less';
import Cookies from 'js-cookie';
import { login } from '@/pages/service'

export const contextIndex = createContext()
export default ({ history }) => {
    useEffect(() => {
      (async() => {
        const hasCookie = Cookies.get('myCo')
        if (!hasCookie) {
          const res = await login()
          Cookies.set('myCo', res.data.cookie)
        }
      })()
    }, [])
    return (
      <contextIndex.Provider value={{ history }}>
        <div>
            <Footer />
            <Player />
        </div>
      </contextIndex.Provider>
    )
}
